package com.homework.arr;

import java.util.Arrays;

public class Test1 {
  public static void main(String[] args) {
    // 将一个数组中的元素逆序存放。
    int[] arr = new int[] {1, 2, 3, 4, 5, 6};
    int left = 0, right = arr.length - 1;
    while (left < right) {
      int temp = arr[left];
      arr[left] = arr[right];
      arr[right] = temp;
      left += 1;
      right -= 1;
    }
    System.out.println(Arrays.toString(arr));
  }
}
